/* GLScene.h
 *
 * --
 * Copyright (c) 2012, Christophe Huriaux
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * --
 */
#include <graphics/GLCamera.h>

#ifndef GL_SCENE_H
#define GL_SCENE_H

class GLWindow;

class GLScene
{
protected:
	double fovy;
	double aspectRatio;
	double zNear;
	double zFar;
	bool perspectiveChange;

	GLCamera* glCamera;

public:
	GLScene();
	virtual ~GLScene() {}

	GLScene& setFOVy(double fovy);
	GLScene& setAspectRatio(double ratio);
	GLScene& setZNear(double zNear);
	GLScene& setZFar(double zFar);
	GLScene& setPerspective(double fovy, double aspectRatio, double zNear,
		double zFar);

	GLScene& setCamera(GLCamera* camera) { glCamera = camera; return *this; }
	GLCamera* getCamera() { return glCamera; }

	double getFOVy() { return fovy; }
	double getAspectRatio() { return aspectRatio; }
	double getZNear() { return zNear; }
	double getZFar() { return zFar; }

protected:
	virtual void draw() { };

	void updatePerspective();
	void updateCamera();

	friend class GLWindow;
};

#endif // GL_SCENE_H
